'use strict'

const marked = require('marked')

function parseDoc (text, fmt = 'html') {
  let html = marked.parse(text)

  if (fmt === 'text') {
    return html.replace(/<[^>]+>/ig, '')
  }

  return html
}

module.exports = parseDoc
